package com.hhf.demo_04;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @Author: 黄恒锋
 * @DateTime: 2024/5/11 20:41
 * @Description: 取面条
 */
public class Foodie extends Thread{
    ArrayBlockingQueue<String> queue;
    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true){
            // 不断的去堵塞队列取面条
            try {
                String take = queue.take();
                System.out.println(take);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
